package com.go.running.service;

import com.go.core.bean.RunningScore;
import com.go.core.repo.RunningScoreRepo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("runningService")
public class RunningService {

    @Autowired
    RunningScoreRepo runningScoreRepo;

    // 保存玩家信息
    public RunningScore save(RunningScore player){
        return runningScoreRepo.save(player);
    }

    public RunningScore findPlayerByUUID(String uuid){
        return runningScoreRepo.findByUUID(uuid);
    }

    // 记录玩家分数
    public int updateScoreByUUID(String uuid, int score){
        return runningScoreRepo.updateScoreByUUID(uuid, score);
    }

    // 获取排行榜
    public List<RunningScore> getScoreBorad(){
        return runningScoreRepo.getScoreBorad();
    }

}
